from django.db import models

# Create your models here.

from django.db import models

# Create your models here.
from BaseWeb.models import DetailPage

class DetailComment(models.Model):
    id = models.AutoField(primary_key=True)
    COMMENT_TIME = models.DateTimeField(auto_now_add=True)
    FIRSTNICKNAME = models.CharField(max_length=80, default='匿名用户')
    IS_PRAISE = models.BooleanField(default=True)
    TAG = models.CharField(max_length=80)
    COMMENT = models.TextField()
    PRAISE_NUM = models.IntegerField(verbose_name='点赞量', default=0)
    CANDELETE = models.IntegerField(verbose_name='是否可删除', default=1)

    Comment_DetailPage = models.ForeignKey(DetailPage, related_name='comments', on_delete=models.CASCADE)

    class Meta:
        ordering = ('COMMENT_TIME',)

    def __str__(self):
        return 'Comments by {} on {}'.format(self.FIRSTNICKNAME, self.COMMENT_TIME)
